//
//  RootNavigationController.swift
//  SwiftYC
//
//  Created by tenltrs on 2018/9/6.
//  Copyright © 2018年 Tenltrs. All rights reserved.
//

import UIKit

class RootNavigationController: UINavigationController,UINavigationControllerDelegate,UIGestureRecognizerDelegate {
    
    override func viewDidLoad() {
        super.viewDidLoad()
        
        self.interactivePopGestureRecognizer?.delegate=self;
        
        navigationBar.setBackgroundImage(UIImage.init(), for: .default)
        navigationBar.shadowImage=UIImage.init()
        navigationBar.nn_backgroundViewHidden = false;
    }
    
    override func pushViewController(_ viewController: UIViewController, animated: Bool) {
        
        if self.viewControllers.count>0{
            viewController.hidesBottomBarWhenPushed = true
            DispatchQueue.main.asyncAfter(deadline: .now() + 0.12) {
                super.pushViewController(viewController, animated: animated)
            }
        }else{
            super.pushViewController(viewController, animated: animated)
        }
    }
    
    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
        // Dispose of any resources that can be recreated.
    }
    
}
